import request from 'utils/request';

export const getArticleAPI = (params) => {
  return request({
    url: '/v1_0/mp/articles',
    method: 'get',
    params,
  });
};

export const getArticleDeleteAPI = (id) => {
  return request({
    url: '/v1_0/mp/articles/' + id,
    method: 'delete',
  });
};

export const ArticleAddAPI = (data, draft = false) => {
  return request({
    url: `/v1_0/mp/articles?draft=${draft}`,
    method: 'post',
    data,
  });
};

export const getArticlePublishByIdAPI = (id) => {
  return request({
    url: `/v1_0/mp/articles/` + id,
    method: 'get',
  });
};

export const ArticleEditByIdAPI = (data, draft = false) => {
  return request({
    url: `/v1_0/mp/articles/${data.id}?draft=${draft}`,
    method: 'put',
    data,
  });
};
